import numpy as np

#1D join，result ID
arr1 = np.array([1, 2, 3])
arr2 = np.array([4, 5, 6])
arr = np.concatenate((arr1, arr2))
print("np.concatenate(([1, 2, 3], [4, 5, 6])) :",arr)


#2D Join，array[2,2] axis = 1
arr1 = np.array([[1, 2], [3, 4]])
arr2 = np.array([[5, 6], [7, 8]])
arr = np.concatenate((arr1, arr2), axis=1)
print("np.concatenate(([[1, 2], [3, 4]], [[5, 6], [7, 8]]), axis=1):",arr)
print("np.concatenate(([[1, 2], [3, 4]], [[5, 6], [7, 8]]), axis=0):",np.concatenate((arr1, arr2), axis=0))

#Join,use stack functions,axis = 1 ?
arr1 = np.array([1, 2, 3])
arr2 = np.array([4, 5, 6])
arr = np.stack((arr1, arr2), axis=1)
print("np.stack(([1, 2, 3], [4, 5, 6]), axis=1):",arr)
print("np.stack(([1, 2, 3], [4, 5, 6]), axis=0):",np.stack((arr1, arr2), axis=0))

#stacking along Rows:hstack,等价于np.concatenate((arr1, arr2))
arr1 = np.array([1, 2, 3])
arr2 = np.array([4, 5, 6])
arr = np.hstack((arr1, arr2))
print(arr.shape,"np.hstack(([1, 2, 3], [4, 5, 6])):",arr)


#stacking along Column 等价于np.stack((arr1, arr2), axis=0)
arr1 = np.array([1, 2, 3])
arr2 = np.array([4, 5, 6])
arr = np.vstack((arr1, arr2))
print(arr.shape, "np.vstack(([1, 2, 3], [4, 5, 6]))",arr)

#stacking along height（depth）
arr1 = np.array([1, 2, 3])
arr2 = np.array([4, 5, 6])
arr = np.dstack((arr1, arr2))
print(arr.shape,"np.dstack(([1, 2, 3], [4, 5, 6]))",arr)
